from packages.common.base_model import db, BaseModel


class FileInfo(BaseModel):
    """
    文件信息模型
    """
    __tablename__ = "sys_file_info"
    __table_args__ = ({"comment": "文件信息"})
    url = db.Column(db.String, name="url", unique=False, nullable=True, comment="文件访问地址")
    size = db.Column(db.BigInteger, name="size", unique=False, nullable=True, comment="文件大小，单位字节")
    sizeInfo = db.Column(db.String, name="size_info", unique=False, nullable=True, comment="文件大小，有单位")
    filename = db.Column(db.String, name="filename", unique=False, nullable=True, comment="文件名称")
    originalFilename = db.Column(db.String, name="original_filename", unique=False, nullable=True, comment="原始文件名")
    basePath = db.Column(db.String, name="base_path", unique=False, nullable=True, comment="基础存储路径")
    path = db.Column(db.String, name="path", unique=False, nullable=True, comment="存储路径")
    ext = db.Column(db.String, name="ext", unique=False, nullable=True, comment="文件扩展名")
    contentType = db.Column(db.String, name="content_type", unique=False, nullable=True, comment="MIME类型")
    platform = db.Column(db.String, name="platform", unique=False, nullable=True, comment="存储平台")
    thUrl = db.Column(db.String, name="th_url", unique=False, nullable=True, comment="缩略图访问路径")
    thFilename = db.Column(db.String, name="th_filename", unique=False, nullable=True, comment="缩略图大小，单位字节")
    thSize = db.Column(db.BigInteger, name="th_size", unique=False, nullable=True, comment="缩略图大小，单位字节")
    thSizeInfo = db.Column(db.String, name="th_size_info", unique=False, nullable=True, comment="缩略图大小，有单位")
    thContentType = db.Column(db.String, name="th_content_type", unique=False, nullable=True, comment="缩略图MIME类型")
    objectId = db.Column(db.String, name="object_id", unique=False, nullable=True, comment="文件所属对象id")
    objectType = db.Column(db.String, name="object_type", unique=False, nullable=True, comment="文件所属对象类型，例如用户头像，评价图片")
    attr = db.Column(db.String, name="attr", unique=False, nullable=True, comment="附加属性")
    isDeleted = None
